package com.cn.springcloudwechat.mapper.mapper;

import com.cn.springcloudwechat.common.mybatis.Page;
import com.cn.springcloudwechat.model.YmAnswer;
import com.cn.springcloudwechat.model.find.communication.YmAnswerVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface YmAnswerMapper {
    int deleteByPrimaryKey(Long answerId);

    int insert(YmAnswer record);

    /**
     * 评论的回复
     * @param record
     * @return
     */
    Integer insertSelective(YmAnswer record);

    YmAnswerVO selectByPrimaryKey(Long answerId);

    int updateByPrimaryKeySelective(YmAnswer record);

    int updateByPrimaryKeyWithBLOBs(YmAnswer record);

    int updateByPrimaryKey(YmAnswer record);

    List<YmAnswerVO> queryYmAnswerList(@Param("exchangeId")Long exchangeId,@Param("type")Integer type);

    int updateByAnswerId(@Param("answerId")String[] answerId);
    /**
     * 查询回复内容
     * @param typeId
     * @param type
     * @return
     */
    List<YmAnswerVO> queryYmAnswerDetail(@Param("typeId")Long typeId,@Param("type")Integer type);

    /**
     * 查询回复内容
     * @param typeId
     * @param type
     * @return
     */
    List<YmAnswerVO> queryYmAnswerDetailMrg(@Param("typeId")Long typeId,@Param("type")Integer type, Page<YmAnswerVO> page);

    String queryParentName(Long parentId);

    /**
     * 回复数量查询
     * @param typeId
     * @param type
     * @return
     */
    Long getAnswerQuantity(@Param("typeId") Long typeId,@Param("type") Integer type);

    /**
     * 问医生-根据answerUserId和type查询属于当前用户的所有历史提问
     * @param  answerUserId,type
     * @return List<YmAnswer>
     */
    List<YmAnswerVO> queryYmAnswersByAnswerUserId(@Param("answerUserId")Long answerUserId,@Param("type")Integer type);

    /**
     * 问医生-根据根据typeId和answerUserId查询当前用户提问医生的回复明细
     * @param  answerUserId, type
     * @return List<YmAnswer>
     */
    List<YmAnswerVO> queryYmAnswerDetailByAnswerUserId(@Param("typeId")Long typeId, @Param("answerUserId")Long answerUserId, @Param("type")Integer type);

    /**
     * 问医生-根据选中的问题查询该提问的详情
     * @param  typeId,answerUserId
     * @return List<YmAnswer>
     */
    List<YmAnswerVO> queryYmAnswerDetailByTypeIdAndAnswerUserId(@Param("typeId")Long typeId,@Param("parentAnswerId")Long parentAnswerId);
    /**
     * 问医生-根据answerId和typeId查询当前用户提问医生的回复
     * @param typeId,,answerId,type
     * @return List<YmAnswer>
     */
    public List<YmAnswer> queryYmAnswerDetailByTypeId(@Param("typeId")Long typeId,@Param("answerUserId")Long answerUserId, @Param("type")Integer type);

    /**
     * 问医生-查询属于当前医生的所有提问
     * @param typeId,,answerUserId,type
     * @return List<YmAnswer>
     */
    public List<YmAnswerVO> queryYmAnswerListByTypeId(@Param("typeId")Long typeId, @Param("type")Integer type);

    /**
     * 问医生-查询提问回复数
     * @param typeId,,answerUserId,type
     * @return Integer number
     */
    public Integer queryYmAnswerCount(@Param("typeId")Long typeId, @Param("type")Integer type, @Param("parentAnswerId")Long answerUserId);

}